.PHONY: arm
OBJECTS=swi.o vdu.o archio.o i2c.o main.o arminit.o armarc.o emurate.o
CFLAGS := -Iarm -Iinclude -I. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
TARGET=acorn
LDFLAGS:=$(LDFLAGS) -lncurses

ifeq ($(DEBUG),yes)
CFLAGS +=  -O0 -g
else
CFLAGS += -O3 -funroll-loops -fexpensive-optimizations -ffast-math -fomit-frame-pointer -frerun-cse-after-loop
endif

all: arm $(TARGET)
$(TARGET): arm $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) arm/libarm.a -o $(TARGET)
arm:
	make -C arm 
clean:
	make -C arm clean
	rm -rf *~ $(OBJECTS) $(TARGET)
